package org.robotfish.learn;

import org.ejml.simple.SimpleMatrix;

public class GaussianProdFeatures extends GaussianFeatures {
	int prodFeature;
	int power;

	/**
	 * @param kernels  centers of Gaussians
	 * @param sigma   gaussian bandwidth
	 * @param gaussFeature the feature to use
	 * @param cycle   period of the function (0 means no cycle)
	 */
	public GaussianProdFeatures( double[] kernels, double sigma, int gaussFeature, double cycle, int prodFeature, int power ) {
		super( kernels, sigma, gaussFeature, cycle );
		this.prodFeature = prodFeature;
		this.power = power;
	}
	
	@Override
	public double[] feat(SimpleMatrix x) {
		double[] f = super.feat(x);
		for (int i=0; i<f.length; i++) {
			f[i] *= Math.pow( x.get(prodFeature), power );
		}
		return f;
	}
}
